import numpy as np

# 定义输入数据和权重
def create_data(num_samples, num_features):
    # 随机生成输入数据
    X = np.random.rand(num_samples, num_features)
    # 随机生成权重
    W = np.random.rand(num_features, 1)
    return X, W

# 进行线性变换
def linear_model(X, W):
    return np.dot(X, W)

# 主函数
if __name__ == "__main__":
    num_samples = 5  # 样本数量
    num_features = 3  # 特征数量

    # 创建数据
    X, W = create_data(num_samples, num_features)

    # 打印输入数据和权重
    print("输入数据 (X):")
    print(X)
    print("\n权重 (W):")
    print(W)

    # 进行特征提取
    features = linear_model(X, W)

    # 打印特征提取的数据
    print("\n特征提取的数据:")
    print(features)